Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.1] Fix empty usernames in database + bug in username generation #18379

Merged
merged 8 commits into from
Jun 12, 2024

Conversation

jdavcs
Copy link
Member

@jdavcs jdavcs commented Jun 11, 2024

This is a follow-up to #18364 (ref #18364 (comment)).
I've testing this locally (the CI will run the migration too)

This also fixes a newly-discovered bug introduced in #16724 during migrating db code to SA2.0 (see commit description).
I'll backport the bug fix to 23.2. I'm not targeting this at 23.2 because this has tests that rely on data access testing infrastructure introduced in 24.1.

Question: do we want to apply the same type of fix to the tool_shed database schema and data? If so, I'll add a commit with a TS migration.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@jdavcs jdavcs added kind/bug area/database Galaxy's database or data access layer labels Jun 11, 2024
@jdavcs jdavcs added this to the 24.1 milestone Jun 11, 2024
@jdavcs jdavcs requested review from dannon and mvdbeek June 11, 2024 23:18
@jdavcs
Copy link
Member Author

jdavcs commented Jun 12, 2024

The packages error is an import error (managers modules are not available for data). I'll fix this.

@jdavcs
Copy link
Member Author

jdavcs commented Jun 12, 2024

I have dropped the unit test for now (it passed) - I'll add it in a separate PR targeting dev. For this to be testable from within the data package, the test should not import from managers. In dev, this is easily solvable by moving db-specific functions into the new model/db location.

update,
)

from galaxy.managers.users import username_from_email_with_connection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't import from managers here, that breaks the package structure. Generally speaking it's probably wise to have a fixed copy in the migration so we don't alter migration results accidentally.

Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

jdavcs added 8 commits June 12, 2024 10:09
Otherwise revision details are displayed in list output:

INCORRECT:
92fb564c7095 -> ddbdbc40bdc1 (gxy), add workflow_comment table
Revision ID: ddbdbc40bdc1
Revises: 92fb564c7095
Create Date: 2023-08-14 13:41:59.442243
987ce9839ecb, e93c5d0b47a9 -> 92fb564c7095 (gxy) (mergepoint), Merge alembic heads after pulling external_user_id length extension forward

EXPECTED:
92fb564c7095 -> ddbdbc40bdc1 (gxy), add workflow_comment table
987ce9839ecb, e93c5d0b47a9 -> 92fb564c7095 (gxy) (mergepoint), Merge alembic heads after pulling external_user_id length extension forward
The bug was introduced when moving this code to SQLAlchemy 2.0
The statement in generate_next_available_username should be evaluated at
each step of the iteration: only then will the new value of `i` result
in a new statement.
@jdavcs jdavcs force-pushed the 241_fix_usernames_in_db branch from 7f4c0f8 to 51309da Compare June 12, 2024 14:12
@jdavcs jdavcs merged commit f3ff434 into galaxyproject:release_24.1 Jun 12, 2024
43 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer kind/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants